/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bio.jpa.entities;

import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Diego
 */
@Entity
@Table(name = "qualifier", catalog = "biodb", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Qualifier.findAll", query = "SELECT q FROM Qualifier q"),
    @NamedQuery(name = "Qualifier.findByIdQualifier", query = "SELECT q FROM Qualifier q WHERE q.idQualifier = :idQualifier"),
    @NamedQuery(name = "Qualifier.findByName", query = "SELECT q FROM Qualifier q WHERE q.name = :name"),
    @NamedQuery(name = "Qualifier.findBySeq", query = "SELECT q FROM Qualifier q WHERE q.seq = :seq")})
public class Qualifier implements Serializable, Comparable<Qualifier> {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_qualifier")
    private Integer idQualifier;
    @Size(max = 45)
    @Column(name = "name")
    private String name;
    @Lob
    @Size(max = 16777215)
    @Column(name = "value")
    private String value;
    @Column(name = "seq")
    private Integer seq;
    @JoinColumn(name = "key_fk", referencedColumnName = "id_feature_key")
    @ManyToOne(optional = false)
    private FeatureKey keyFk;

    public Qualifier() {
    }

    public Qualifier(String name, String value, Integer seq, FeatureKey keyFk) {
        this.name = name;
        this.value = value;
        this.seq = seq;
        this.keyFk = keyFk;
    }

    public Integer getIdQualifier() {
        return idQualifier;
    }

    public void setIdQualifier(Integer idQualifier) {
        this.idQualifier = idQualifier;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public Integer getSeq() {
        return seq;
    }

    public void setSeq(Integer seq) {
        this.seq = seq;
    }

    public FeatureKey getKeyFk() {
        return keyFk;
    }

    public void setKeyFk(FeatureKey keyFk) {
        this.keyFk = keyFk;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idQualifier != null ? idQualifier.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Qualifier)) {
            return false;
        }
        Qualifier other = (Qualifier) object;
        if ((this.idQualifier == null && other.idQualifier != null) || (this.idQualifier != null && !this.idQualifier.equals(other.idQualifier))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.bio.jpa.entities.Qualifier[ idQualifier=" + idQualifier + " ]";
    }
    
    @Override
    public int compareTo(Qualifier q) {
        return getSeq().compareTo(q.getSeq());
}
}
